package com.violet.common.config;

import com.nepxion.banner.BannerConstant;
import com.nepxion.banner.Description;
import com.nepxion.banner.LogoBanner;
import com.taobao.text.Color;
import com.violet.common.util.CustomBanner;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 类说明: 项目启动 banner初始化
 *
 * @author wqf
 * @date 2022/10/12 16:31
 */
public class BannerInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
    @Override
    public void initialize(ConfigurableApplicationContext applicationContext) {
        if (!(applicationContext instanceof AnnotationConfigApplicationContext)) {
            //elementLineLocation bannner高度
            LogoBanner logoBanner = new LogoBanner(BannerInitializer.class, "/violet/banner.txt",
                    "Welcome to violet", 1, 22, new Color[1], true);
            CustomBanner.show(logoBanner, new Description(BannerConstant.VERSION + ":", "1.0.0", 0, 1)
                    , new Description("Github:", "https://github.com/zlt2000", 0, 1)
                    , new Description("Blog:", "https://zlt2000.gitee.io", 0, 1)
            );
        }
    }
}